UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XWgqyZPYv9yg1U2lE9hHrIlO0ByuTbkX46qnp4jeIkE='
WHERE
key_id = '19907a8b979ff1f89f7d128b03c59d8ee966e38fe358a27b531d607976de14c0'
AND (
token = 'XWgqyZPYv9yg1U2lE9hHrIlO0ByuTbkX46qnp4jeIkE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)