UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PuDeVvDb3rzC82hI8tW7XdGu7caMBQ4hxQ0EojlgCzk='
WHERE
key_id = 'f9a20d19d0563e7906c6807cb4609ab79a8dcac674e0a027aad584d75d47c6b2'
AND (
token = 'PuDeVvDb3rzC82hI8tW7XdGu7caMBQ4hxQ0EojlgCzk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)