UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZzfDunru39ck8fnJ7vb19t7n0bphXgzhsvmzr/7x/sg='
WHERE
key_id = '2717f575357ffc75b2dd564aa3a2549f360342e90ff0e87825bc130e0f9d2100'
AND (
token = 'ZzfDunru39ck8fnJ7vb19t7n0bphXgzhsvmzr/7x/sg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)