UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Vz87EnvWdKDS3AUwbrt+qP2IbFRWOA+DJA2zzk0RUS0=' 
WHERE 
  key_id = '522eed256e09d9b099fb759581b071cbf2a803789a47f1e7980b7466ada99f0a' 
  AND (
    token = 'Vz87EnvWdKDS3AUwbrt+qP2IbFRWOA+DJA2zzk0RUS0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041