UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QyV4Dlv1yM7By+aLUGw3oEHBFqfp95k7V3b1n0WIsNw='
WHERE
key_id = 'b966ba9ebc7879b1e2d365e311114b7e3b45f0cd9b9d3a67385936e038679549'
AND (
token = 'QyV4Dlv1yM7By+aLUGw3oEHBFqfp95k7V3b1n0WIsNw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)