UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 's6TshDUdF+Tk+Sv+/Yvkt6F8Ig70tglrhWOYHwSmefk=' 
WHERE 
  key_id = '1d9dc718b16e84fe2b6446411d87180b9868662e29450c710e58d64570421fdf' 
  AND (
    token = 's6TshDUdF+Tk+Sv+/Yvkt6F8Ig70tglrhWOYHwSmefk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056