UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 300, 
  token = 'Rur2+ftICd8P5MiC/5QvB/JybAO1LiJt+EIAGdRD++4=' 
WHERE 
  key_id = '50082925a1418a203fb7b9f3505cd7df090234d673cebf9bc1ccdb276a9a7831' 
  AND (
    token = 'Rur2+ftICd8P5MiC/5QvB/JybAO1LiJt+EIAGdRD++4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043