UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N/R9bHrSwSM8IJZPefJ4vfphPsLC8IkjAlovYEjF738=' 
WHERE 
  key_id = '2d8110bf3c3ec0da2a3260641294b2a09f6a469b33a67bc99594ca622d9f57ff' 
  AND (
    token = 'N/R9bHrSwSM8IJZPefJ4vfphPsLC8IkjAlovYEjF738=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041