UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0DfmiOwXwX1HgDapwlQIsaydh+vqTRA8YEwE+CaHm64=' 
WHERE 
  key_id = '9b1259ef37ade44dc936ac16bc6793ce3489eb5c79155eb71e27944adeca8a46' 
  AND (
    token = '0DfmiOwXwX1HgDapwlQIsaydh+vqTRA8YEwE+CaHm64=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023