UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd3ElCRokqJYrXNxfjow531vczjxLnYt3P+fmxyPFDMs=' 
WHERE 
  key_id = 'c24757b059d7abf4eb9c2eefcdde92f4390f92c3f1e3784c29b117e2d2c23fa2' 
  AND (
    token = 'd3ElCRokqJYrXNxfjow531vczjxLnYt3P+fmxyPFDMs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019