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