UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qRkYOGNAfO0/Y2LosZsLxXZIrXNfx7xSlYNwJY+hels=' 
WHERE 
  key_id = 'de149bb18b799555c72aea2d8ac15c72997068fe1df69319d55fdcfb6f6424d8' 
  AND (
    token = 'qRkYOGNAfO0/Y2LosZsLxXZIrXNfx7xSlYNwJY+hels=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016