UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fX0Olnf0sbpX0IMeuWobITGm8tfrA+IBFIv+wVZZfLI=' 
WHERE 
  key_id = 'f3ff1c2b69e99f7d166a604815f2a862b5b2cbb36ff2d346d025c88571c7f4d6' 
  AND (
    token = 'fX0Olnf0sbpX0IMeuWobITGm8tfrA+IBFIv+wVZZfLI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057