UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VuuaqgXwjQAPN+Pz3GY0BAyasSMo3rIZeNGUfDaTGPM=' 
WHERE 
  key_id = '3a59f57137d46581e1ba6c3739f6531c8420a8d260b14b8d7d28bd38e10c1107' 
  AND (
    token = 'VuuaqgXwjQAPN+Pz3GY0BAyasSMo3rIZeNGUfDaTGPM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031