UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8UyQR51FDrdKtskKZhuwdb3aOo9HQQzdJu+yoASssto='
WHERE
key_id = 'c2f584d46f8d36feba2cf581d3a825651d68072e88043c13dd160dc4e799df23'
AND (
token = '8UyQR51FDrdKtskKZhuwdb3aOo9HQQzdJu+yoASssto='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)