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