UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CpigQSoCTmQ3MutaDSbHrsNpCHApqmKyF9kI9qAL+vk=' 
WHERE 
  key_id = 'bc12930703e054419c474a899b66190530efadddcccbc4f2839cacc30af4146c' 
  AND (
    token = 'CpigQSoCTmQ3MutaDSbHrsNpCHApqmKyF9kI9qAL+vk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019