UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n+IQ8+TVRud0n9QlGupDzg3JKpYO3sAnvZV4RYOXR8k=' 
WHERE 
  key_id = 'e7a374af2d6a9702ec7229565e1604a605e1d44ad87a5e9fb4f40cc0894137a1' 
  AND (
    token = 'n+IQ8+TVRud0n9QlGupDzg3JKpYO3sAnvZV4RYOXR8k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038