UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KIxh/76OWwmoV7Jnfrqp2srK9PWaH5elELLgGHe7wuc='
WHERE
key_id = '56a9ee38e6e23894183bedb2ffca1eb831b70e374a2576c03794ae47f62e65f0'
AND (
token = 'KIxh/76OWwmoV7Jnfrqp2srK9PWaH5elELLgGHe7wuc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)