UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oKtYfG+OHAWRnYv0MLi/Oajbb3vQmMZRCPmcA5PzaKI=' 
WHERE 
  key_id = '30749287d0b3f70100e1b48d2c8c29f930362d299d0e4def7e4a4f8e043d62d4' 
  AND (
    token = 'oKtYfG+OHAWRnYv0MLi/Oajbb3vQmMZRCPmcA5PzaKI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022