UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '650uYG1Ta1deHvCdRuabNFJ/8imCCV2a+pwBz29EB44='
WHERE
key_id = 'd9bb6f07d463f79836a4cd2185ab4da22f7b5fd6c7dbaacbb9ba3482730775df'
AND (
token = '650uYG1Ta1deHvCdRuabNFJ/8imCCV2a+pwBz29EB44='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)