UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IA4TKCqBjvPvQuWaqfexNzKP+N4s00QhzCwcQVz1PE0=' 
WHERE 
  key_id = 'ebf4747266887e3c2469add6d20f41bae6472caa7f9b50d204b2b617319634f5' 
  AND (
    token = 'IA4TKCqBjvPvQuWaqfexNzKP+N4s00QhzCwcQVz1PE0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021