UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Bu4yVXS8OUYeFi8feKYMv5RZslWTT4DIhplc1oNY7cs='
WHERE
key_id = '9ff1f3d1a43cd288dfc7966be6fda4611935c2293ef097087610648dba70c1c9'
AND (
token = 'Bu4yVXS8OUYeFi8feKYMv5RZslWTT4DIhplc1oNY7cs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)