UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'J5IV4nu/+3z+hbBfSMgHlLXLhG2cLCxFnIgJSWZ0uwM='
WHERE
key_id = '001b520466ac9d01447be9664b9eed01bae2f37b52c91d2cae2c8d439f4ba2ec'
AND (
token = 'J5IV4nu/+3z+hbBfSMgHlLXLhG2cLCxFnIgJSWZ0uwM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)