UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZnV4gykM4br+wWBU+JeslTcCVSQk7gjoqewpL0WH3tE='
WHERE
key_id = 'dec19b934a317eece5ee51bf7fa069bf28f35978b65b127e860eed1ba4de24fa'
AND (
token = 'ZnV4gykM4br+wWBU+JeslTcCVSQk7gjoqewpL0WH3tE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)