UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QTtTQ96e3Ufxc+s8R9j/9i9KNthNlqabLDNP7pANXCA='
WHERE
key_id = 'cf5a323559a63f141a2e19fbb88f9eba13de30487282b38a79a4593e2fe35f1e'
AND (
token = 'QTtTQ96e3Ufxc+s8R9j/9i9KNthNlqabLDNP7pANXCA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)