UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'phb7Ry+HarOYThGBGZa3RAccrRW6GAaj7dewW+Dqpzo=' 
WHERE 
  key_id = '3d2c86163dd4a41078cb9ae3a7e6806515320e371767bea4f7b260756632fc48' 
  AND (
    token = 'phb7Ry+HarOYThGBGZa3RAccrRW6GAaj7dewW+Dqpzo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022