UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gK4xAnJMV3dkYqmsCK5wCOiBU95XiIaBBT4aYTAjprs='
WHERE
key_id = '92c8da532837b4951e829b99fc8bad470b6302bac4b9c1870d9c1fde66fa1ecf'
AND (
token = 'gK4xAnJMV3dkYqmsCK5wCOiBU95XiIaBBT4aYTAjprs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)