UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1DbU583Zn3HV2KXS7abevfQwnfipFJl7+pAH0PmVirs=' 
WHERE 
  key_id = 'da4014c4b11a7c29477f67c46a6209e59b3a838b0c212ef10c37992059920667' 
  AND (
    token = '1DbU583Zn3HV2KXS7abevfQwnfipFJl7+pAH0PmVirs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022