UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 't6Olp654+vzfvdJu0JQBb1iSgEnH0gHgnvbEUEvSNFs=' 
WHERE 
  key_id = '4c431728170ce6ea8f47e7c4913e93b82d424490fdc76c1e52c57bfcd36d4ef6' 
  AND (
    token = 't6Olp654+vzfvdJu0JQBb1iSgEnH0gHgnvbEUEvSNFs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043