UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/UbA9OTY+/54BviFUsy4Gl9+gprecItxNun9MTFeQxU='
WHERE
key_id = 'ef512fed591450a529213728c0e9aa371d91bcdc68f9994b5a4b0bc91c082421'
AND (
token = '/UbA9OTY+/54BviFUsy4Gl9+gprecItxNun9MTFeQxU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)