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