UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1NUUPhFVvuEaXgKgFSJmlMsIKHQhOkzeIbMou0nfs9k='
WHERE
key_id = 'f7ee2d3fb29958811897a72581d6b380bec452bd23e2239873a353322c2fc4f5'
AND (
token = '1NUUPhFVvuEaXgKgFSJmlMsIKHQhOkzeIbMou0nfs9k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)