UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lnY4xAERg5/PkKeHxnbsdLm4WUfy1iMVz8zDz+41d38='
WHERE
key_id = 'e9b0f59225e2aaf07c05dcc68e95e93b9f827dc4d60602cb2101bc7a138c1090'
AND (
token = 'lnY4xAERg5/PkKeHxnbsdLm4WUfy1iMVz8zDz+41d38='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)