UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gZPhMNNluiROUtX3tcwFzkJLQDYyFEkcvPtsXUXQwaQ='
WHERE
key_id = '50a2b1552b6eff0d9e3650d25855541940fd94291a7aae046e2f4c19ab931c35'
AND (
token = 'gZPhMNNluiROUtX3tcwFzkJLQDYyFEkcvPtsXUXQwaQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)