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