UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UR3BlwgdF+b4oY3cmRMOdUZlgt7dJ6tXcIpUgoHvuVI=' 
WHERE 
  key_id = '24c249d9f741686be9bcd34b5bdff9703406eda388bb663fc092996508188a8b' 
  AND (
    token = 'UR3BlwgdF+b4oY3cmRMOdUZlgt7dJ6tXcIpUgoHvuVI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041