UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cg9LlDdYHx8qVZqnHdhDx1bcusOJzXism9cHwUWtMbo=' 
WHERE 
  key_id = '717cae455cbc6d1cf6ab3aa232ffb9a310ee43b76362e49ff59832ae1155a4ef' 
  AND (
    token = 'cg9LlDdYHx8qVZqnHdhDx1bcusOJzXism9cHwUWtMbo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037