UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wPHzAGsjdS1joBuorpBJzVg8qA1RipYctNa6yNnQNdU=' 
WHERE 
  key_id = 'c8fb55169b9f9510b86eb6e08c61f155997754c0740d155e7b55a30734118bb0' 
  AND (
    token = 'wPHzAGsjdS1joBuorpBJzVg8qA1RipYctNa6yNnQNdU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035