UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oXENO+1QCwnX6TCFM49q7g4S+hYxRP0q0aDZqXkHZUI=' 
WHERE 
  key_id = 'b59af84facd4e200937e329c415bda5ed3923495e89154b67b49aa5566c8919c' 
  AND (
    token = 'oXENO+1QCwnX6TCFM49q7g4S+hYxRP0q0aDZqXkHZUI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042