UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OGhijqvtJfKbZd5JiEQUVNAo24BAsV7QZKDfsKsL2pA=' 
WHERE 
  key_id = '72d510da78234be322043649c4418192f74156b51d4c1e7f1d7f4b4390d370c0' 
  AND (
    token = 'OGhijqvtJfKbZd5JiEQUVNAo24BAsV7QZKDfsKsL2pA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030