UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '49x91oPSTKkgJim+HFg0s/+A2EDvp+CxY8L93RWXuMs='
WHERE
key_id = '591936720d4ec21844699de70de23a2f56974d3f33588a594b561ff5f200576c'
AND (
token = '49x91oPSTKkgJim+HFg0s/+A2EDvp+CxY8L93RWXuMs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)