UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GcsyK8DaDXbhNqlHK33INccvHmlCW1md0XiGpF+2tZc=' 
WHERE 
  key_id = '1396b0b127f779b9c3b037005252856844dbcde3ba79bc4132122e9b8b8d14d8' 
  AND (
    token = 'GcsyK8DaDXbhNqlHK33INccvHmlCW1md0XiGpF+2tZc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025