UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uQHsmuLiNZMZH21jNBelmPQGQFKxD7u7c1fK4FjGyLA='
WHERE
key_id = '31b74181e248a4680c43a06c04f0c9776ed9fceaf015fb8afc47688a91fb75c9'
AND (
token = 'uQHsmuLiNZMZH21jNBelmPQGQFKxD7u7c1fK4FjGyLA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)