UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qPtHV7rIgP6Tp8wySzPTGuDAPoCgriLc0q/7Fr+chdw='
WHERE
key_id = 'b01c9e44723eeb822ace774d29057117cae240f23f454e99bca9c467b6336a42'
AND (
token = 'qPtHV7rIgP6Tp8wySzPTGuDAPoCgriLc0q/7Fr+chdw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)