UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rNGKlYl1+VUz1x6fZiLzphH2hYgNuPJdriLEfNNW2zk='
WHERE
key_id = '84c8d464ba1cd06a8a6ed0b4446a98ba46fde66e607459d26f358f25b09fe012'
AND (
token = 'rNGKlYl1+VUz1x6fZiLzphH2hYgNuPJdriLEfNNW2zk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)