UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DGZvClmPRYX1aWXipTQ1/FmZJSKVmaic8nM/h7fbAV4='
WHERE
key_id = 'a678ee3fba132a9234d2067177d7213fd7cfee5c386887bb2744b7c8d2cc5ba1'
AND (
token = 'DGZvClmPRYX1aWXipTQ1/FmZJSKVmaic8nM/h7fbAV4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)