UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qFyVbvIsIdt3HxPa1U90CGqHd/H8+itvhtERkfuHHlY='
WHERE
key_id = 'dafed9ee24f679094abed7cdaf1ecef90c41d15ed3c72861205a3d508bd515c9'
AND (
token = 'qFyVbvIsIdt3HxPa1U90CGqHd/H8+itvhtERkfuHHlY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)