UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ywBgZQPfexchCIxxICo2gXd9l3++9Cc/49K1TBAb+ts=' 
WHERE 
  key_id = 'b99b1bae834ab6c40d629c54d4a57fc4ecbc8dc56a470293c2d2cd66c210f3a6' 
  AND (
    token = 'ywBgZQPfexchCIxxICo2gXd9l3++9Cc/49K1TBAb+ts=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043