UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0gn2tgs1ZHq+mdvu40993nrh3TqCgP4gAF7eqF99l7g=' 
WHERE 
  key_id = 'defcfba242107e52a061280153605467af16399591318b44a190e1efb52ab2c5' 
  AND (
    token = '0gn2tgs1ZHq+mdvu40993nrh3TqCgP4gAF7eqF99l7g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040